#!/bin/bash
public_ip=$(curl ipinfo.io/ip)
my_ip="$(cat /home/public-ip/my-ip)"
now=$(date +%s || echo '99999999999999999')
send_time=$(cat /home/public-ip/send_time || echo '0')

if [[ "$public_ip" != "$my_ip" ]] && (( now - send_time >= 3650 ))
then
    /home/ding-msg/ding_to 16619954624 "${public_ip}" && 
    echo "$public_ip" > /home/public-ip/my-ip &&
    echo "$now" > /home/public-ip/send_time
fi